﻿using System;
using System.Collections.Generic;

class Course
{
    HashSet<Student> courseStudents;
    public HashSet<Student> CourseStudents
    {
        get { return this.courseStudents; }
    }

    public Course()
    {
        courseStudents = new HashSet<Student>();
    }

    public void AddStudent(Student student)
    {
        if (CourseStudents.Count > 30)
            throw new OverflowException("Each course should contain at most 30 students");

        courseStudents.Add(student);
    }

    public void DismissStudent(Student student)
    {
        if (courseStudents.Contains(student))
        {
            courseStudents.Remove(student);
        }
        else
        {
            throw new ArgumentException("The student is not in the selected course.");
        }
    }
}